home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
man
/
cmds.fmt
/
fscheck.man
< prev
next >
Wrap
Text File
|
1990-03-19
|
18KB
|
465 lines
FSCHECK User Commands FSCHECK
_________________________________________________________________
NNAAMMEE
fscheck - perform consistency check on file system
SSYYNNOOPPSSIISS
ffsscchheecckk --ddeevv _d_e_v_i_c_e --ppaarrtt _p_a_r_t_i_t_i_o_n [[_o_p_t_i_o_n_s]
OOPPTTIIOONNSS
--ddeevv _d_e_v_i_c_e _D_e_v_i_c_e is the root name of a device, i.e.
rxy0, rsd1, rsb0
--ppaarrtt _p_a_r_t_i_t_i_o_n
_P_a_r_t_i_t_i_o_n is a letter indicating a partition,
i.e. a, b, c, d, e, f, g.
--ddiirr _d_e_v_D_i_r _D_e_v_D_i_r is an alternate directory in which to
find the device file named by concatenating
_D_e_v_i_c_e and _P_a_r_t_i_t_i_o_n. The default directory
name is ``/dev/``.
--iinniittiiaallPPaarrtt _f_i_r_s_t_P_a_r_t_N_a_m_e
_f_i_r_s_t_P_a_r_t_N_a_m_e is the name of the initial par-
tition on the disk which contains basic disk
geometry information. The default is parti-
tion ``a''.
--wwrriittee Write the disk when errors are encountered and
fixed. The default is to not write the disk.
--ssiilleenntt Don't say anything unless there is an error.
--vveerrbboossee Output verbose information about errors. The
default is to print out terse information.
--iinnccVVeerrssiioonn If the domain was not written back properly on
system shutdown then all version numbers will
be incremented.
--ffiixxRRoooott Re-create a missing or corrupted root direc-
tory.
--cclleeaarr Clear the domain number field stored in the
summary sector.
--hhoossttIIDD _i_d Update the host ID in the disk header. If _i_d
is not 0 then it is used as the host id to put
in the header. If _i_d equals 0 then one of two
values are used as the host id. If the device
server is the local host then the kernel's
internal idea of its host id is used, other-
wise the device server's id is used.
Sprite v.1.0 Printed: March 19, 1990 1
FSCHECK User Commands FSCHECK
--bbaaddBBlloocckk Initialize the bad block file descriptor.
--oouuttppuuttFFiillee _o_u_t_p_u_t_F_i_l_e
All output to stdout and stderr is also
appended to _o_u_t_p_u_t_F_i_l_e.
--bbuuffffeerrSSiizzee _s_i_z_e
Set the size of the buffer associated with
_o_u_t_p_u_t_F_i_l_e to _s_i_z_e bytes. Default is to use
whatever buffer is provided by the stdio
library. This option has no effect if the
--oouuttppuuttFFiillee option is not used.
--rroooottPPaarrtt This option controls the output to a file. If
the --oouuttppuuttFFiillee option is not given then this
option has no effect. Otherwise, the output is
stored in a buffer and only written to the
file when the program exits. This allows the
output to be written to a file on the parti-
tion being checked (usually the output is
written to the root partition). The file IO
in this case is very primative and restric-
tive. The output file must be in the root
directory and must exist prior to running
ffsscchheecckk. If the size of the output exceeds
the size of the file or if it exceeds the size
of the direct data blocks then it will be
truncated. If the output exceeds the size of
the internal buffer it will be truncated (see
--bbuuffffeerrSSiizzee ). If the output is smaller than
the size of the file, the remaining part of
the file will be filled with null characters.
Any file produced by this option will have a
decimal number in the first line which
represents the number of bytes in the file.
This is used by ffsscchheecckk to calculate the
starting point for appending. The output file
can be reset by either setting the first
number to 0 or by overwriting the file with
null characters.
--hheeaappLLiimmiitt _s_i_z_e
Program will not allocate more than _s_i_z_e bytes
of memory. Default is to allocate as much as
is needed.
--ddeelleettee If a data block is shared by more than one
file, delete it from all but one of the files.
The default is to make a copy of the block for
each file sharing the original.
--rreeaaddBBlloocckk _c_o_u_n_t
Sprite v.1.0 Printed: March 19, 1990 2
FSCHECK User Commands FSCHECK
Read count blocks at a time when reading the
file descriptors. Currently this does not pro-
vide better performance due to limitations in
the disk interface library.
--ddeebbuugg Print out debugging information.
--bbiittmmaappVVeerrbboossee
Print out lots and lots of information about
errors in the bitmaps.
--nnuummRReebboooott _c_o_u_n_t
Number of consecutive times to reboot before
returning a warning indication.
--cclleeaarrFFiixxCCoouunntt
Clear consecutive fix counter.
_________________________________________________________________
DDEESSCCRRIIPPTTIIOONN
This program will perform a consistency check on a file sys-
tem. By default it will report inconsistencies but won't
repair them. If the --wwrriittee option is used then it will
repair any inconsistencies by modifying the disk as neces-
sary.
This program performs the following consistency checks:
1. It makes sure that the file descriptor allocation bit
map agrees with the status information kept in each
file descriptor. If necessary it will correct the bit
map.
2. It confirms that data-block and indirect-block pointers
are valid. If a pointer is invalid then the pointer is
set to NIL and the file size is adjusted as necessary
to reflect the new size of the file.
3. It recreates the data block allocation bit map based on
information in the file descriptors and indirect
blocks.
4. It checks for blocks that are allocated to more than
one file. If a block is multiply allocated then copies
of the block are made and all but one of the files is
corrected to use a copy. If the --ddeelleettee option is
given, or if only a subset of the fragments in a block
are shared, then the block is given to the lowest num-
bered file descriptor and it is removed from all other
files that reference it. A special case is made of
block 0. This block belongs to the root directory and
is copied (or deleted) for all other files even if the
Sprite v.1.0 Printed: March 19, 1990 3
FSCHECK User Commands FSCHECK
root directory is corrupted or doesn't exist.
5. It verifies that directories are of the proper format.
In order to patch a directory, names may be deleted,
the directory may be truncated, or in the worst case
the directory may be turned into a normal file.
6. It puts unreferenced files into the lost+found direc-
tory. The name of each file in the lost+found direc-
tory is the file's file descriptor number.
7. It corrects link counts and block counts in each file
descriptor.
8. It checks that indirect blocks contain valid pointers.
If the pointers are invalid and the block is part of a
file then a hole is created, otherwise if the block is
part of a directory then the directory is truncated.
9. It checks that each file descriptor contains a valid
magic number. If this is not the case then the file
descriptor is cleared and marked as unused in the bit-
map.
10. It recreates the root directory if it is corrupted and
the --ffiixxRRoooott option is given.
By default only terse information is given about the errors
in the file system. Only the first error per file is
reported. If the --vveerrbboossee option is given then more verbose
information will be given. If the --bbiittmmaappVVeerrbboossee option is
given then differences between the bitmaps on disk and the
recreated bitmaps are printed. Since the bitmaps on disk are
not kept current use of this option is likely to produce
lots of output.
The ffsscchheecckk program will also perform other actions depend-
ing on the options that are specified. If the --iinnccVVeerrssiioonn
option is given then flags in the file system header are
checked to see if the file system was safely written back
when it was detached or the system went down. If it is
determined that the file system was not safely written back
then the version numbers for all files in the file system
are incremented. This will cause all reopens of files
because of recovery to fail.
If the --ffiixxRRoooott option is given the root directory will be
recreated if it has become corrupted. If the root is
recreated, then any directories that have the root directory
as their parent will be inserted into the root with their
file descriptor number as their name. Any files that used
to be in the root directory will be placed in lost+found.
Sprite v.1.0 Printed: March 19, 1990 4
FSCHECK User Commands FSCHECK
FFsscchheecckk assumes that data block 0 belongs to the root direc-
tory and will allocate this block to the directory when
reconstructing it. The --ffiixxRRoooott option requires reading the
root directory twice, hence it cannot be used without the
--wwrriittee option.
The --cclleeaarr option should be used if the domain number field
should be cleared from the summary sector. Each file system
that is attached is given a domain number under which it can
be identified. When a file system is attached, the system
will try to attach it with the same domain number that it
was attached under last time. This is required to allow
clients of the file system to recover when the file system
is reattached. If the domain number field is cleared from
the summary sector, then the system will attach the file
system under a domain number of the system's choosing.
The --hhoossttIIDD option will force the system to update the host
id in the file system header. If the device under which the
file system is being attached is generic then the id of the
host on which ffsscchheecckk is run is used. Otherwise the host id
specified by the device file is used. The default is not to
modify the host id.
The --bbaaddBBlloocckk option will initialize the file descriptor
which points to bad disk blocks. Initializing it will clear
out any pointers to bad blocks that are currently in the
file descriptor.
The --hheeaappLLiimmiitt option can be used to place an upper limit on
the size of the program heap. This can be used to prevent
paging, since paging cannot be done at the point in the boot
sequence when ffsscchheecckk is run. If ffsscchheecckk cannot complete
checking the disk because of the limit then it will do as
much as it can. This should allow multiple runs of ffsscchheecckk
to completely check the disk. The limit is only an approxi-
mation of how large ffsscchheecckk will grow, since the program
stack is not restricted. Therefore the limit should be set
as high as possible but it should not be set to the boundary
at which paging will occur. If it is set too small then
ffsscchheecckk may not be able to run at all. Note that the bbuuffffeerr--
SSiizzee and rreeaaddBBlloocckk options will affect the amount of heap
required. As a rule of thumb, the amount of heap space
needed by ffsscchheecckk is proportional to the disk size and the
amount of errors on the disk. A heap limit of 1 Mb should be
sufficient for all but the most extreme cases.
Each time ffsscchheecckk runs and finds an error in a partition, a
counter on disk is incremented. The value of this counter is
the number of consecutive times ffsscchheecckk has run on the par-
tition and corrected an error. If the counter exceeds the
value given by the --nnuummRReebboooott option (default 4) and if
Sprite v.1.0 Printed: March 19, 1990 5
FSCHECK User Commands FSCHECK
ffsscchheecckk corrects an error, then ffsscchheecckk will return
EXIT_NOREBOOT instead of the standard soft error indication.
This allows higher level software to avoid infinite reboot
loops.
The --cclleeaarrFFiixxCCoouunntt option resets the consecutive counter to
0.
Finally, the --oouuttppuutt, --bbuuffffeerrSSiizzee and --nnooFFlluusshh options con-
trol the output from fscheck. The --oouuttppuutt option allows the
output from fscheck to be put into a file as well as printed
on stdout and stderr. The --bbuuffffeerrSSiizzee option sets the size
of the IO buffer associated with the output file. The
--nnooFFlluusshh option prevents the buffer from being flushed until
the disk has been checked and corrected. This allows the
output to be written to the disk being checked. If the out-
put exceeds the size of the buffer then it is truncated to
the buffer size. If the buffer size is exceeded in the mid-
dle of an output string, then remainder of the string will
wrap over the beginning of the buffer.
EEXXIITT CCOODDEESS
FFsscchheecckk has a large number of exit codes. Positive values
indicate that some sort of error occurred that requires
ffsscchheecckk be run again, although an exit code of 1 indicates
that the filesystem was corrupted but was successfully
corrected. Negative error codes indicate that a serious
error occurred that requires user action before fscheck can
be run again.
0 No errors occurred and no errors were fixed in the
filesystem.
1 Errors were fixed in the filesystem.
2 FFsscchheecckk ran out of memory before it was able to com-
pletely check the disk. Rerunning with the same heap
limit should allow ffsscchheecckk to finish.
3 Errors were fixed in the filesystem and the number of
consecutive times ffsscchheecckk has fixed this partition
exceeds the limit.
-1 An unspecified hard error occurred.
-2 A disk read failed.
-3 A disk write failed.
-4 There was a problem with one of the arguments.
-5 The heap limit is too small for ffsscchheecckk to run. The
Sprite v.1.0 Printed: March 19, 1990 6
FSCHECK User Commands FSCHECK
heap limit must be made larger before rerunning
ffsscchheecckk.
-6 The disk is full so that duplicate blocks cannot be
copied. Either delete some stuff or rerun using the
--ddeelleettee option.
BBUUGGSS//FFEEAATTUURREESS
Indirect blocks are always marked as in use in the bitmap,
even if they contain invalid entries. This is because the
block may be in use by another file and cannot be marked as
free.
The --ffiixxRRoooott option cannot be used without the --wwrriittee
option.
KKEEYYWWOORRDDSS
file system, disk
Sprite v.1.0 Printed: March 19, 1990 7